home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 11842 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.2 KB  |  41 lines

  1. Path: news.iadfw.net!usenet
  2. From: Mark Nelson <markn@airmail.net>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Why won't this work?
  5. Date: Sat, 16 Mar 1996 10:19:19 -0600
  6. Organization: customer of Internet America
  7. Message-ID: <314AEA07.B60@airmail.net>
  8. References: <4icjqa$km4@masala.cc.uh.edu>
  9. NNTP-Posting-Host: dal23-03.ppp.iadfw.net
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0GoldB1 (Win95; I)
  14.  
  15. Sensarn wrote:
  16. > struct human {
  17. >     int age;
  18. > };
  19. > void main(void) {
  20. >     human bob;
  21. >     asm mov ax,bob.age; /* Expression Syntax error here */
  22. > }
  23. > Please help
  24.  
  25. While most MS-DOS/Windows compilers support some sort of in-line assembly, 
  26. their capabilities differe greatly.  You need to specify which compiler
  27. you are using in order to determine what it can and cannot do.  For example,
  28. if you are using Watcom, the code shown above will never work, because
  29. you have to put your asm code in a function definition via pragma.
  30.  
  31. I use inline assembly in one place in Greenleaf ArchiveLib, and it
  32. is a horrible looking mess of #ifdefs and hacks, since I'm supporting 
  33. a whole bunch of different compilers.  Ugh.
  34.  
  35. Mark Nelson
  36. http://web2.airmail.net/markn
  37.